export default {
  data() {
    return {
      enterTypeSelect: [], //入库类型下拉框列表
      outTypeSelect: [], //出库类型下拉框列表
      warehouseListSelect: [], //仓库下拉框列表
      warehouseUserList: [], //仓库成员列表
    };
  },
  methods: {
    /**
     * 获取部门下拉框列表
     */
    getEnterTypeSelect() {
      return new Promise((resolve) => {
        this.$.debouchment
          .entryTypeDict({})
          .then((result) => {
            if (result.e.code == 200) {
              this.enterTypeSelect = result.result.map((v) => {
                return {
                  label: v.name,
                  value: v.id,
                };
              });
            } else {
              this.$message.error(result.e.msg);
            }
            resolve(result);
          })
          .catch((err) => {
            resolve(false);
          });
      });
    },
    /**
     * 获取部门下拉框列表
     */
    getOutTypeSelect() {
      return new Promise((resolve) => {
        this.$.debouchment
          .outTypeDict({})
          .then((result) => {
            if (result.e.code == 200) {
              this.outTypeSelect = result.result.map((v) => {
                return {
                  label: v.name,
                  value: v.id,
                };
              });
              

            } else {
              this.$message.error(result.e.msg);
            }
            resolve(result);
          })
          .catch((err) => {
            resolve(false);
          });
      });
    },
    /**
     * 获取仓库拉框列表
     */
    getWarehouseListSelect() {
      return new Promise((resolve) => {
        this.$.warehouse
          .warehouseDict({warehouse_state:'all'})
          .then((result) => {
            if (result.e.code == 200) {
              this.warehouseListSelect = result.result.warehouseList.map(
                (v) => {
                  return {
                    label: v.warehouse_short_name,
                    value: v.id,
                  };
                }
              );
            } else {
              this.$message.error(result.e.msg);
            }
            resolve(result);
          })
          .catch((err) => {
            resolve(false);
          });
      });
    },
  },
};
